React Js / Components / Conditional Rendering
Conditional Rendering
-
1. Step
Solution 1: in view
const age=48; return( ) Solution 2: using variable in componenet
let canWatch="Not Available"; if(age > 18 ) { canWatch="Watch Now"; } return( ) Solution 3: using function in in componenet
const canWatch =() => { if(age >18){ return "Watch Now"; } else{ return "Not Available"; } } return( )
MANVIA BLOG